package com.example.demo.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 2020-07-03 chenzz
 */

public enum GradeEnum {
    SMLL_ClASS(100, "小班", 1),
    MIDDLESHIFT(200, "中班", 1),
    BIGCLASS(300, "大班", 1),
    PRESCHOOL(400, "学前班", 6),

    ONE(500, "一年级", 2),
    TWO(600, "二年级", 2),
    THREE(700, "三年级", 2),
    FOUR(800, "四年级", 2),
    FIVE(900, "五年级", 2),
    SIX(1000, "六年级", 2),

    FIRST_ONE(1100, "初一", 3),
    FIRST_TWO(1200, "初二", 3),
    FIRST_THREE(1300, "初三", 3),

    SENIOR_ONE(1400, "高一", 4),
    SENIOR_TWO(1500, "高二", 4),
    SENIOR_THREE(1600, "高三", 4);

    GradeEnum(int code, String key, int type) {
        this.code = code;
        this.key = key;
        this.type = type;
    }

    private final int type;
    private final int code;
    private final String key;

    public int getType() {
        return type;
    }

    public int getCode() {
        return code;
    }

    public String getKey() {
        return key;
    }

    /**
     * 根据codes过滤枚举
     *
     * @param codes
     * @return
     */
    public static List<GradeEnum> getEnumsByCodes(List<Integer> codes) {
        List<GradeEnum> gradeEnumList = new ArrayList<>();
        for (GradeEnum mm : GradeEnum.values()) {
            if (codes.contains(mm.code)) {
                gradeEnumList.add(mm);
            }
        }
        return gradeEnumList;
    }
}
